package com.cloud.seata.stock.service.impl;

import com.cloud.seata.stock.mapper.StockMapper;
import com.cloud.seata.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class StockServiceImpl implements StockService {

    @Autowired
    private StockMapper stockMapper;

    @Override
    @Transactional
    public String decr(Boolean flag) {
        stockMapper.decr();

        if (flag) {
            throw new RuntimeException();
        }
        return "创建订单成功";
    }

}
